package com.starinside.wp.foundation.constant;

import lombok.Setter;

/**
 * *******************************
 * Created by Ron.
 * form com.tuo51
 * on 2017/8/4
 * *******************************
 */
public class CommonConstant {

    public enum Platform {
        WEB(1, "WEB"),
        PAD(2, "PAD"),
        APP(3, "PHONE"),
        WXMA(4, "WXMA"),// wechat micro application
        WXMP(5, "WXMP"),
        OP(6, "OP");

        @Setter
        private int code;

        @Setter
        private String value;

        Platform(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public Platform get(int code){
            for (Platform loginChannel : values()) {
                if (loginChannel.codeOf()==code)
                    return loginChannel;
            }
            return null;
        }
    }


    public enum Gender{
        FEMALE(0, "女"),
        MALE(1, "男");

        @Setter
        private int code;

        @Setter
        private String value;

        Gender(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public Gender get(int code){
            for (Gender gender : values()) {
                if (gender.codeOf()==code)
                    return gender;
            }
            return null;
        }
    }

}
